<template>
  <div class="minBox">
    <div class="main flex-x-center-stretch">
      <div class="left flex-y-between-stretch">
        <patient :data="patientInfoData" />
        <div class="signBox flex-x-between-stretch">
          <VitalSigns ref="vitalSignsRef"></VitalSigns>
          <ultrasonic ref="ultrasonicRef"></ultrasonic>
        </div>
      </div>
      <div class="right flex-y-center-stretch">
        <command />
        <MapContainer></MapContainer>
      </div>
    </div>
    <IndexBar @update="update"></IndexBar>
  </div>
</template>

<script setup lang="ts" name="rescue">
import MapContainer from "./components/MapContainer/index.vue";
import command from "./components/command.vue";
import patient from "./components/patient.vue";
import VitalSigns from "./components/VitalSigns.vue";
import ultrasonic from "./components/ultrasonic.vue";
import IndexBar from "./components/IndexBar/index.vue";

import { patientInfo } from "@/api/modules/rescue";
import { onMounted, ref } from "vue";
import { useUserStore } from "@/stores/modules/user";
const userStore = useUserStore();

let patientInfoData = ref();
let deviceList = ref();
const getPatientInfo = async () => {
  let { data } = await patientInfo({ carNo: userStore.selectAmbulance.carNo });
  patientInfoData.value = data.patientInfo;
  deviceList.value = data.deviceList;
};
onMounted(() => {
  getPatientInfo();
});
const update = () => {
  getPatientInfo();
};
</script>

<style scoped lang="scss">
.left {
  flex: 1;
  .signBox {
    flex: 1;
    margin-top: 10px;
    padding: 0 15px 10px;
    box-sizing: border-box;
    height: 0;
    width: 1110px;
    background-image: url("../../assets/images/rescue/monitor.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}
.titleBox {
  height: 70px;
  padding: 10px;
  position: relative;
  background-image: url("../../assets/images/vehicle/title.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  .title {
    font-size: 36px;
    color: #ffffff;
    font-weight: bold;
    text-align: center;
    .icon {
      width: 60px;
      height: 50px;
      margin-right: 5px;
    }
  }
}
.main {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  .right {
    width: 730px;
    box-sizing: border-box;
  }
}
.divider {
  width: 60px;
  background-image: url("../../assets/images/vehicle/divider.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  &.row {
    background-image: url("../../assets/images/vehicle/dividerRow.png");
    width: auto;
    height: 40px;
    margin: 0 30px;
    margin-left: calc(45% + 60px);
  }
}
.minBox {
  padding: 5px 30px;
  display: flex;
}

:deep(.BoxTitle) {
  color: #ffffff;
  text-shadow: 0px 0px 9px rgba(32, 22, 0, 0.45);
  font-size: 18px;
  height: 30px;
  font-weight: bold;
  display: flex;
  align-items: center;
  margin-left: -10px;

  .icon {
    width: 25px;
    height: 25px;
    margin-right: 10px;
    margin-left: 20px;
  }
}
</style>
